import java.util.Arrays;

public class SolutionLCP66 {
    public int minNumBooths(String[] demand) {
        int[] f=new int[26];
        for (String s : demand) {
            int[] g=new int[26];
            for (char c : s.toCharArray()) {
                g[c-'a']++;
                f[c-'a']=Math.max(f[c-'a'],g[c-'a']);
            }
        }
        return Arrays.stream(f).sum();
    }

    public static void main(String[] args) {
        System.out.println(new SolutionLCP66().minNumBooths(new String[]{"acd","bed","accd"}));
    }
}
